package com.forum.module.blog.convert.user;

import com.forum.framework.common.util.colletion.CollectionUtils;
import com.forum.framework.common.util.object.BeanUtils;
import com.forum.module.blog.dal.dataobject.user.UserDO;
import com.forum.module.system.api.user.dto.AdminUserRespDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 功能:
 * 作者:ouyzh
 * 日期:2025/3/9 18:57
 */
@Mapper
public interface UserConvert {
    UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);

    default List<AdminUserRespDTO> covertList(List<UserDO> list) {
        return CollectionUtils.convertList(list, this::covert);
    }

    default AdminUserRespDTO covert(UserDO userDO) {
        return BeanUtils.toBean(userDO, AdminUserRespDTO.class);
    }
}
